package com.jeespring.designpattern.strategy;

/**
 * @Title: StrategyPattern
 * @Description:
 * @Author 张朝阳
 * @Date 2021/1/4 23:04
 */
public class StrategyPattern {
    public static void main(String[] args) {
        StrategyContext addStrategy = new StrategyContext(new AddStrategy());
        int result = addStrategy.execute(11, 9);
        System.out.println(result);

        StrategyContext subtractStrategy = new StrategyContext(new SubtractStrategy());
        result = subtractStrategy.execute(11, 9);
        System.out.println(result);

        StrategyContext multiplyStrategy = new StrategyContext(new MultiplyStrategy());
        result = multiplyStrategy.execute(11, 9);
        System.out.println(result);

    }
}
